package com.fuchenyang.getway.filter;

import com.fuchenyang.getway.bean.Message;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Component
public class MessageGatewayFilterFactory extends AbstractGatewayFilterFactory {

    public MessageGatewayFilterFactory(){
        super(Message.class);
    }


    @Override
    public GatewayFilter apply(Object config) {
        return (exchange, chain) -> {
            System.out.println("hello,world");
            return chain.filter(exchange);
        };
    }

    @Override
    public List<String> shortcutFieldOrder() {
        return Arrays.asList("first","last");
    }
}
